<%--
 * list.jsp
 *
 * Copyright (C) 2013 Universidad de Sevilla
 * 
 * The use of this project is hereby constrained to the conditions of the 
 * TDG Licence, a copy of which you may download from 
 * http://www.tdg-seville.info/License.html
 --%>

<%@page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>

<%@taglib prefix="jstl" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@taglib prefix="security"
	uri="http://www.springframework.org/security/tags"%>
<%@taglib prefix="display" uri="http://displaytag.sf.net"%>
<%@taglib prefix="acme" tagdir="/WEB-INF/tags"%>


<display:table pagesize="5" class="displaytag" keepStatus="true"
	name="routes" requestURI="${requestURI}" id="row">

	<security:authorize access="hasRole('ADMINISTRATOR')">
		<display:column>
			<a href="route/administrator/edit.do?routeId=${row.id}"> <spring:message
					code="route.view" />
			</a>
		</display:column>
	</security:authorize>

	<security:authorize access="hasRole('PARTICIPANT')">
		<display:column>
			<a href="route/participant/edit.do?routeId=${row.id}"> <spring:message
					code="route.view" />
			</a>
		</display:column>
	</security:authorize>



	<spring:message code="route.name" var="nameHeader" />
	<display:column property="name" title="${nameHeader}" sortable="false" />

	<spring:message code="route.length" var="lengthHeader" />
	<display:column property="length" title="${lengthHeader}"
		sortable="false" />

	<spring:message code="route.difficulty" var="difficultyHeader" />
	<display:column property="difficulty" title="${difficultyHeader}"
		sortable="false" />

	<spring:message code="route.orderNumber" var="orderNumberHeader" />
	<display:column property="orderNumber" title="${orderNumberHeader}"
		sortable="false" />


	<spring:message code="route.rating" var="ratingHeader" />
	<display:column property="rating" title="${ratingHeader}"
		sortable="false" />


	<spring:message code="route.event" var="eventHeader" />
	<display:column property="event.title" title="${eventHeader}"
		sortable="false" />

</display:table>

<!-- Action links -->

<security:authorize access="hasRole('ADMINISTRATOR')">
	<jstl:if test="${isOwner && notStarted && noParticipants}">
		<a href="route/administrator/create.do?eventId=${eventId}"> <spring:message
				code="route.create" />
		</a>
	</jstl:if>

</security:authorize>

<security:authorize access="hasRole('ADMINISTRATOR')">
	<acme:cancel code="route.goBack" url="${backURI}" />
</security:authorize>

<security:authorize access="hasRole('PARTICIPANT')">
	<acme:cancel code="route.goBack" url="${backURI}" />
</security:authorize>

	<security:authorize access="isAnonymous()">
		<acme:cancel code="route.goBack" url="${backURI}" />
	</security:authorize>
